import Taro, {Component} from '@tarojs/taro'
import {View, Button, Text, Swiper, SwiperItem, Image, ScrollView} from '@tarojs/components'
import {connect} from '@tarojs/redux'
import {
  set_userinfo, set_cart, set_goodslist, set_viplist, set_bind_car_num, set_progress,
  set_pushdata, set_pushdatanum, gohome_btn, set_cart_num,
} from '../../actions/IndexAction'
import base from "../base"
import {AtTabs, AtTabsPane, AtInput} from 'taro-ui'
import './index.less'
import set from "../../apis/api"

class add_devices extends Component {
  constructor(props) {
    super(props)
    base(this)
    this.state = {
      current: 0,
      value: "",
      air1:"00",
      air2:"00",
      air3:"00",
      deviceset1:{
        value:"",
        list:[
          {name:"空调 1",value:0},
          {name:"空调 2",value:0},
          {name:"空调 3",value:0},
          {name:"正压风机",value:0},
          {name:"负压风机",value:0},
          {name:"去尘刷",value:0},
          {name:"",value:0},
          {name:"",value:0},
        ]
      },
      deviceset2:{
        value:"",
        list:[
          {name:"阀 1",value:0},
          {name:"水 箱",value:0},
          {name:"直流屏",value:0},
          {name:"多路电表",value:0},
          {name:"电信设备",value:0},
          {name:"移动设备",value:0},
          {name:"联通设备",value:0},
          {name:"",value:0},
        ]
      },
      liuliang:"0000",
      deviceset3:{
        value:"",
        list:[
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"0",value:0},
          {name:"MD0",value:0},
        ]
      },
      upCycle:"01",
      maxTemperature:35,
      fanStartTemperature:35,
      fanStopTemperature:36,

    }
  }

  config = {
    navigationBarTitleText: '参数设定',
    enablePullDownRefresh: true,
    navigationBarBackgroundColor: "#4bb33d",
    navigationBarTextStyle: "white"

  }

  onReachBottom() {


  }
  setAir1(val)
  {
    this.setState({
      air1:val
    })
  }
  setAir2(val)
  {
    this.setState({
      air2:val
    })
  }
  setAir3(val)
  {
    this.setState({
      air3:val
    })
  }
  setLiuliang(val)
  {
    this.setState({
      liuliang:val
    })
  }
  setMaxTemperature(val)
  {
    this.setState({
      maxTemperature:val
    })
  }
  setFanStartTemperature(val)
  {
    this.setState({
      fanStartTemperature:val
    })
  }
  setFanStopTemperature(val)
  {
    this.setState({
      fanStopTemperature:val
    })
  }
  setUpCycle(val)
  {
    this.setState({
      upCycle:val
    })
  }
  getValue(list)
  {
    var value="";
    list.map((item)=>{
      value+=item.value+"";
  })
    return value;
  }
  selectDs1(key)
  {
    this.state.deviceset1.list[key].value=this.state.deviceset1.list[key].value==0?1:0
    this.state.deviceset1.value=this.getValue(this.state.deviceset1.list);
    this.setState({
      deviceset1:this.state.deviceset1
    })
  }
  selectDs2(key)
  {
    this.state.deviceset2.list[key].value=this.state.deviceset2.list[key].value==0?1:0
    this.state.deviceset2.value=this.getValue(this.state.deviceset2.list);
    this.setState({
      deviceset2:this.state.deviceset2
    })
  }
  selectDs3(key)
  {
    this.state.deviceset3.list[key].value=this.state.deviceset3.list[key].value==0?1:0
    if(this.state.deviceset3.list[key].name==0||this.state.deviceset3.list[key].name==1)
    {
      this.state.deviceset3.list[key].name=this.state.deviceset3.list[key].value;
    }
    this.state.deviceset3.value=this.getValue(this.state.deviceset3.list);
    this.setState({
      deviceset3:this.state.deviceset3
    })
  }
  componentWillReceiveProps(nextProps) {
    console.log(this.props, nextProps)
  }

  onPullDownRefresh() {
    wx.stopPullDownRefresh();
  }

  componentWillUnmount() {
    console.log("ccccccc");
    var pages=getCurrentPages();
    var prevPage=pages[pages.length-2];
    prevPage.setData({
      isBack:true
    })

  }

  componentDidShow() {
    this.onPullDownRefresh()


  }

  buqi(val)
  {
    var res=val;
    console.log(val);
    console.log(parseInt(val))
    if(parseInt(val)<10)
    {
      res="0"+parseInt(val);
    }
    return res
  }
  finishSet() {
    wx.showLoading({title: "加载中"})
    var databody={
      access_token:this.props.gytoken.gytoken,
      wxid:this.props.sys_config.sets.wxid,
      d_sn:this.$router.params.dev_sn,
      post1:this.buqi(this.state.air1),//空调1
      post2:this.buqi(this.state.air2),//空调2
      post3:this.buqi(this.state.air3),//空调3
      post4:this.state.deviceset1.value,//功能1
      post5:this.state.deviceset2.value,//功能2
      post6:this.state.liuliang,//流量
      post7:this.state.deviceset3.value,//模式
      post8:this.buqi(this.state.upCycle),//周期
      post9:this.buqi(this.state.maxTemperature),//温度
      post10:this.buqi(this.state.fanStartTemperature),//温度
      post11:this.buqi(this.state.fanStopTemperature),//温度

    }
    this.wx_request(set.setupat, databody,"POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data)=>
    {
      console.log(data);
      wx.stopPullDownRefresh();
      wx.hideLoading();
      if(data.data.status==100)
      {
        this.doSub();
      }else{
        wx.showToast({
          title: data.data.msg,
          icon: 'none',
          duration: 1800
        })
        return;
      }



    }).catch((err)=>{
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: '网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }

  doSub()
  {
    if(this.$router.params.action=="add")
    {
      this.addSub();
    }
    if(this.$router.params.action=="del")
    {
      this.delSub();
    }
  }
  addSub()
  {
    wx.showLoading({title: "加载中",mask:true})
    var databody={
      access_token:this.props.gytoken.gytoken,
      wxid:this.props.sys_config.sets.wxid,
      d_sn:this.$router.params.dev_sn,
      b_id:this.$router.params.id,
      d_list:this.$router.params.codes

    }

    console.log(databody);
    this.wx_request(set.dev_install, databody,"POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data)=>
    {
      console.log("add",data);


      wx.stopPullDownRefresh();
      wx.hideLoading();
      wx.showToast({title:"添加成功",icon:"none",duration:1800});
      setTimeout(()=>{
        Taro.navigateBack({
          delta:3
        })
      },500)


    }).catch((err)=>{
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title:  err.data.msg?err.data.msg:'网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }

  delSub() {
    wx.showLoading({title: "加载中"})
    var databody={
      access_token:this.props.gytoken.gytoken,
      wxid:this.props.sys_config.sets.wxid,
      d_sn:this.$router.params.dev_sn,
      code:this.$router.params.code,
    }
    console.log(databody);
    this.wx_request(set.device_del, databody,"POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data)=>
    {
      console.log("delete",data);
      wx.stopPullDownRefresh();
      wx.hideLoading();
      wx.showToast({title:"删除成功",icon:"none",duration:1800});
      setTimeout(()=>{
        Taro.navigateBack({
          delta:3
        })
      },500)

    }).catch((err)=>{
      wx.hideLoading();
      wx.stopPullDownRefresh();
      wx.showToast({
        title: err.data.msg?err.data.msg:'网络访问失败，请重试',
        icon: 'none',
        duration: 1800
      })
    })

  }

  componentDidHide() {
  }

  render() {
    const {deviceset1,deviceset2,deviceset3}=this.state;
    return (
      <View style={{flex: 1}}>
        <ScrollView>
          <View style={{flex: 1,paddingBottom:"180rpx"}}>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e", height: "30rpx",borderRadius:"5rpx",}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设置温度设定
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{flex: 1, display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center"}}>
                      <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          空调1
                        </Text>
                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>

                    <View style={{width:"260rpx",height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",padding:"5rpx",overflow:"hidden"}}>
                      <AtInput
                        clear
                        type='number'
                        placeholder='请选择温度'
                        value={this.state.air1}
                        onChange={this.setAir1.bind(this)}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}

                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#999999", fontSize: "24rpx"}}>
                        ℃
                      </Text>
                    </View>
                  </View>
                </View>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{flex: 1, display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#81c16a"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          空调2
                        </Text>
                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>

                    <View style={{width:"260rpx",height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",padding:"5rpx",overflow:"hidden"}}>
                      <AtInput
                        clear
                        type='number'
                        placeholder='请选择温度'
                        value={this.state.air2}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        onChange={this.setAir2.bind(this)}
                        confirmType={"确定"}

                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#999999", fontSize: "24rpx"}}>
                        ℃
                      </Text>
                    </View>
                  </View>
                </View>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{flex: 1, display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#acd697"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          空调3
                        </Text>
                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>

                    <View style={{width:"260rpx",height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",padding:"5rpx",overflow:"hidden"}}>
                      <AtInput
                        clear
                        type='number'
                        placeholder='请选择温度'
                        value={this.state.air3}
                        onChange={this.setAir3.bind(this)}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}

                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#999999", fontSize: "24rpx"}}>
                        ℃
                      </Text>
                    </View>
                  </View>
                </View>

              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e",borderRadius:"5rpx", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备类别--1
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexWrap:"wrap"}}>
                {deviceset1.list.map((item,key)=>{
                  return(<View onClick={this.selectDs1.bind(this,key)} key={key} style={{display:"flex",alignItems:"center",justifyContent:"center",height:"50rpx",margin:"10rpx 8rpx"}}>
                    <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:item.value==1?"#32b16c":"#d2d2d2"}}>
                      <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                        {item.name}
                      </Text>
                    </View>
                  </View>)
                })}
              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备类别--2
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexWrap:"wrap"}}>
                {deviceset2.list.map((item,key)=>{
                  return(<View onClick={this.selectDs2.bind(this,key)} key={key} style={{display:"flex",alignItems:"center",justifyContent:"center",height:"50rpx",margin:"10rpx 8rpx"}}>
                    <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:item.value==1?"#32b16c":"#d2d2d2"}}>
                      <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                        {item.name}
                      </Text>
                    </View>
                  </View>)
                })}
              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e",borderRadius:"5rpx", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex",justifyContent:"space-between"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备流量预警值设置
                  </Text>
                  <Text style={{fontSize: "20rpx", color: "#333333"}}>
                    注：0xFFFF无效
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"260rpx",borderRadius:"20rpx",height:"40rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          4G流量预警值 L
                        </Text>
                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end",paddingLeft:"30rpx"}}>
                    <View style={{height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",flex:1,overflow:"hidden",padding:"5rpx"}}>
                      <AtInput
                        type='number'
                        placeholder='请输入流量'
                        value={this.state.liuliang}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}
                        onChange={this.setLiuliang.bind(this)}
                      >
                      </AtInput>
                    </View>
                  </View>
                </View>

              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e",borderRadius:"5rpx", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex",justifyContent:"space-between"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备工作模式
                  </Text>
                  <Text style={{fontSize: "20rpx", color: "#333333"}}>
                    注：MD0=0:自主模式;MOD0=1:被动模式
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexWrap:"wrap"}}>
                {deviceset3.list.map((item,key)=>{
                  return(<View onClick={this.selectDs3.bind(this,key)} key={key} style={{display:"flex",alignItems:"center",justifyContent:"center",height:"50rpx",margin:"10rpx 8rpx"}}>
                    <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:item.value==1?"#32b16c":"#d2d2d2"}}>
                      <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                        {item.name}
                      </Text>
                    </View>
                  </View>)
                })}
              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e",borderRadius:"5rpx", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex",justifyContent:"space-between"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备上传周期
                  </Text>


                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"160rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          上传周期
                        </Text>
                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end",paddingLeft:"30rpx"}}>
                    <View style={{height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",flex:1,overflow:"hidden",padding:"5rpx"}}>
                       <AtInput

                          clear
                          type='number'
                          placeholder='默认每分钟一次(1-60分钟)'
                          value={this.state.upCycle}
                          placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                          confirmType={"确定"}
                          onChange={this.setUpCycle.bind(this)}
                        >
                        </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center",marginLeft:"10rpx"}}>
                      <Text style={{color: "#333333", fontSize: "24rpx"}}>
                        分钟
                      </Text>
                    </View>
                  </View>
                </View>

              </View>


            </View>
            <View>

              <View style={{display: "flex", background: "#eeeeee", padding: "5rpx", alignItems: "center"}}>
                <View style={{marginLeft: "15rpx", width: "10rpx", background: "#2bb06e",borderRadius:"5rpx", height: "30rpx"}}>


                </View>
                <View style={{flex: 1, padding: "10rpx", alignItems: "center", display: "flex",justifyContent:"space-between"}}>
                  <Text style={{fontSize: "24rpx", color: "#333333"}}>
                    设备机房（柜）温度设置
                  </Text>
                  <Text style={{fontSize: "20rpx", color: "#333333"}}>
                    注:机房最高:默认39度,机柜最高:默认35度
                  </Text>
                </View>
              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"400rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          设备机房（柜）内允许最高温度
                        </Text>

                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>
                    <View style={{height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",width:"200rpx",overflow:"hidden",padding:"5rpx"}}>
                      <AtInput
                        type='number'
                        placeholder='请输入温度'
                        value={this.state.maxTemperature}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}
                        onChange={this.setMaxTemperature.bind(this)}
                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#333333", fontSize: "24rpx"}}>
                        C
                      </Text>
                    </View>
                  </View>
                </View>

              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"400rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          启动风机温度
                        </Text>

                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>
                    <View style={{height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",width:"200rpx",overflow:"hidden",padding:"5rpx"}}>
                      <AtInput
                        type='number'
                        placeholder='请输入温度'
                        value={this.state.fanStartTemperature}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}
                        onChange={this.setFanStartTemperature.bind(this)}
                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#333333", fontSize: "24rpx"}}>
                        C
                      </Text>
                    </View>
                  </View>
                </View>

              </View>
              <View style={{padding: "10rpx", display: "flex", flexDirection: "column"}}>
                <View style={{padding: "10rpx", borderBottom: "solid 2rpx #eeeeee", display: "flex"}}>
                  <View style={{display: "flex", alignItems: "center", }}>
                    <View style={{display:"flex",alignItems:"center",justifyContent:"center",height:"60rpx"}}>
                      <View style={{width:"400rpx",borderRadius:"25rpx",height:"50rpx",display:"flex",alignItems:"center",justifyContent:"center",background:"#32b16c"}}>
                        <Text style={{color: "#ffffff", fontSize: "24rpx"}}>
                          空调停机温度
                        </Text>

                      </View>
                    </View>
                  </View>
                  <View style={{flex: 1, display: "flex", alignItems: "center", justifyContent: "flex-end"}}>
                    <View style={{height:"50rpx",display: "flex", alignItems: "center", justifyContent: "center",border:"solid 2rpx #cccccc",width:"200rpx",overflow:"hidden",padding:"5rpx"}}>
                      <AtInput
                        type='number'
                        placeholder='请输入温度'
                        value={this.state.fanStopTemperature}
                        placeholderStyle="font-size:24rpx;color:#999999;text-align:center"
                        confirmType={"确定"}
                        onChange={this.setFanStopTemperature.bind(this)}
                      >
                      </AtInput>
                    </View>
                    <View style={{width:"50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
                      <Text style={{color: "#333333", fontSize: "24rpx"}}>
                        C
                      </Text>
                    </View>
                  </View>
                </View>

              </View>


            </View>
          </View>


        </ScrollView>
        <View style={{display:"flex",alignItems:"center",zIndex:9,justifyContent:"center",background:"#ffffff",height:"120rpx",position:"fixed",bottom:"0",width:"100%",borderTop:"2rpx #eeeeee solid"}}>
          <View onClick={this.finishSet.bind(this)} style={{background:"#32b16c",borderRadius:"35rpx",width:"60%",height:"70rpx",display:"flex",alignItems:"center",justifyContent:"center",}}>
            <Text style={{color:"#ffffff",fontSize:"26rpx"}}>
              完成设置
            </Text>

          </View>

        </View>
      </View>
    )
  }
}

const mapstate = state => {
  return {
    userinfo: state.usermodel,
    cart_num: state.cart_num,
    cart: state.cart,
    goodslist: state.goodslist,
    vip: state.vip,
    progress: state.progress,
    pushdata: state.pushdata,
    wxuser: state.wxusermodel,sys_config:state.sys_config,
    gytoken:state.gytoken
  }
}
export default connect(mapstate)(add_devices)

